package com.dzm.demo.myshop.web.ui.controller;

import com.dzm.demo.myshop.commons.utils.HttpClientUtils;
import com.dzm.demo.myshop.commons.utils.MapperUtils;
import com.dzm.demo.myshop.web.ui.api.API;
import com.dzm.demo.myshop.web.ui.api.ContentApi;
import com.dzm.demo.myshop.web.ui.dto.TbContent;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
public class IndexController {

    /**
     * 跳转首页
     * @return
     */
    @RequestMapping(value = {"","index"},method = RequestMethod.GET)
    public String index(Model model){
        //请求幻灯片
        requestContentsPPT(model);
        return "index";
    }

    private void requestContentsPPT(Model model){
        //请求幻灯片
        List<TbContent> tbContents = ContentApi.ppt();
        model.addAttribute("ppt",tbContents);
    }
}
